package cn.com.suiyi.shixingshengxian.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/7/19.
 */
public abstract  class BaseActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayout());
        ButterKnife.inject(this);
        if (savedInstanceState== null){
            setContentView(getLayout());
            ButterKnife.inject(this);
            init();
        }
    }
    void init(){
        initView();
        initData();
    }


    /**
     * 初始化数据
     */
    protected abstract void initData();

    /**
     * 获取布局id
     *
     * @return
     */
    public abstract int getLayout();



    /**
     * 初始化控件
     */
    public abstract void initView();
}
